<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/core/common/top.jsp" %>
<script type="text/javascript" src="${ctx}/core/scripts/cal.js"></script>
<script src="${ctx}/core/scripts/jquery_last.js" type="text/javascript" charset="UTF-8"></script>
<script src="${ctx}/core/scripts/formValidator.js" type="text/javascript" charset="UTF-8"></script>
<script src="${ctx}/core/scripts/formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>
<html>
	<head>
	<%
java.util.HashMap map = new java.util.LinkedHashMap();
map.put(1,"aaa");
map.put(2,"bbb");
map.put(3,"ccc");
request.setAttribute("map",map);
request.setAttribute("aa","2");
%>
	
		<title></title>
		<meta http-equiv="Pragma" content="no-cache">
		<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0">
		<meta http-equiv="Expires" content="0">	
		<script language="javascript" type="text/javascript">
		
		var max_line_num = 0;
		var currentStep = 0;
		
			$(document).ready(function(){
				$.formValidator.initConfig({formid:"form0",tidymode:true,onerror:function(msg) {showMessage(msg);}});
				$("#type").formValidator().inputValidator({min:1,onerror:"类型为必选项"});
				$("#name").formValidator().inputValidator({min:1,max:50,onerror:"名称为必填项",onerrormax:"名称超出50个字符"});
				$("#telphone").formValidator().inputValidator({min:7,max:11,onerror:"电话为必填项",onerrormin:"电话少于8位",onerrormax:"电话多于11位"});
				$("#status").formValidator().inputValidator({min:1,onerror:"状态为必选项"});
				$("city").formValidator().inputValidator({min:1,onerror:"城市为必填项"});
				$("#region").formValidator().inputValidator({min:1,onerror:"区域为必填项"});
				$("#address").formValidator().inputValidator({min:1,onerror:"地址为必填项"});
				$("#positionX").formValidator().inputValidator({min:1,onerror:"经度为必填项"});
				$("#positionY").formValidator().inputValidator({min:1,onerror:"纬度为必填项"});
			});

			function lineclick(line) {
				$('#pricePlanArea tr').each(function() {
					//$(this).css("background-color", "#ffffff");
					$(this).css("background-color", "#DDE4EA");
				});
				var seq = $(line).children("td").html();
				$(line).css("background-color", "#FFCBB3");
				currentStep = seq;
			}

	     function doRemovePrice(id){
	    	 if(confirm("<s:text name='message.delete.confirm'/>")) {
				$("#pricePlanArea tr").each(function() {
					var seq = parseInt($(this).children("td").html());
					if (seq == currentStep){
						$(this).remove();
					}
						
					if (seq > currentStep)
						$(this).children("td").each(function(i){
							if (i == 0)
								$(this).html(seq - 1);
						});
				});
				currentStep = 0;
	    	}
	     }

	     
			
			function up_exchange_line() {
				if (currentStep == 0) {
					alert('请选择一项!');
					return false;
				}
				if (currentStep <= 1) {
					alert('非法操作!');
					return false;
				}
				var upStep = currentStep - 1;
				//修改序号
				$('#line' + upStep + " td:first-child").html(currentStep);
				$('#line' + currentStep + " td:first-child").html(upStep);
				//取得两行的内容
				var upContent = $('#line' + upStep).html();
				var currentContent = $('#line' + currentStep).html();
				$('#line' + upStep).html(currentContent);
				//交换当前行与上一行内容
				$('#line' + currentStep).html(upContent);
				$('#content tr').each(function() {
					$(this).css("background-color", "#ffffff");
				});
				$('#line' + upStep).css("background-color", "yellow");
				currentStep = upStep;
			}
			function down_exchange_line() {
				if (currentStep == 0) {
					alert('请选择一项!');
					return false;
				}
				if (currentStep >= max_line_num) {
					alert('非法操作!');
					return false;
				}
				var nextStep = parseInt(currentStep) + 1;
				//修改序号
				$('#line' + nextStep + " td:first-child").html(currentStep);
				$('#line' + currentStep + " td:first-child").html(nextStep);
				//取得两行的内容
				var nextContent = $('#line' + nextStep).html();
				var currentContent = $('#line' + currentStep).html();
				$('#line' + nextStep).html(currentContent);
				//交换当前行与上一行内容
				$('#line' + currentStep).html(nextContent);
				$('#content tr').each(function() {
					$(this).css("background-color", "#ffffff");
				});
				$('#line' + nextStep).css("background-color", "yellow");
				currentStep = nextStep;
			}
		     
		
	
		
		function doAddPrice(){			
			max_line_num = $("#pricePlanArea tr:last-child").children("td").html();

			//alert(max_line_num);
			if (max_line_num == null) {
				max_line_num = 1;
			} else {
				max_line_num = parseInt(max_line_num);
				max_line_num += 1;
			}
			
			//alert(max_line_num);

            var aa="<tr id='line" + max_line_num
							+ "' onclick='lineclick(this);'><td>"
							+ max_line_num + "</td><td>打开网页" + max_line_num
							+ "</td><td>打开登录网页" + max_line_num
							+ "</td><td>删除&nbsp;&nbsp;编辑</td>"
							+"<td>11</td><td>22</td><td>33</td><td>44</td><td>55</td></tr>";
		  	var indexId=max_line_num-1;
			var content="<tr onclick='lineclick(this);'>"
				+"<td align='center'>"+max_line_num+"</td>"
				+"<td>&nbsp;&nbsp;时段</td>"
				+"<td>"
				+"<select name='priceBean["+indexId+"].timeSegment'><option value='1'>全天</option><option value='2'>上午场(10~13)</option><option value='3'>下午场(13~17)</option><option value='4'>晚场(17~22)</option><option value='5'>夜场(22~02)</option></select>"
				+"</td>"
				+"<td>&nbsp;&nbsp;订价类型</td>"
				+"<td>"
				+"<select name='priceBean["+indexId+"].priceType'><option value='0'>单价</option><option value='1'>打包</option></select>"
				+"</td>"
				+"<td>&nbsp;&nbsp;价格(元)</td>"
				+"<td>"
				+"<input name='priceBean["+indexId+"].price' style='width:80px'></input>"
				+"</td>"
				+"<td>&nbsp;&nbsp;起订数(小时)</td>"							                	
				+"<td>"
				+"<input name='priceBean["+indexId+"].minNum' style='width:80px'></input>"
				+"</td>"
				+"<td align='center'><a href='javascript:doRemovePrice("+max_line_num+")'><img src='${ctx}/core/images/del.gif' name='icon_074' width='16' height='16' border='0' style='CURSOR: hand' title='删除'/></a></td>"
				+"</tr>";							
				//alert(content);			
							
          $('#pricePlanArea').append(content);
		}
		</script>
	</head>
<%-- 				var content="<tr>"
            	+"<td width='3%' align='center'>"+max_line_num+"</td>"
            	+"<td>&nbsp;&nbsp;时段</td>"
            	+"<td>"
            	+"<exts:select id='' name='' value='#it.timeSegment' pageState='%{pageState}' code='TIME_SEGMENT' ></exts:select>"
            	+"</td>"
            	+"<td>&nbsp;&nbsp;订价类型</td>"
            	+"<td>"
            	+"<exts:select id='' name='' value='#it.priceType' pageState='%{pageState}'  code='PRICE_TYPE' ></exts:select>"
            	+"</td>"
            	+"<td>&nbsp;&nbsp;价格</td>"
            	+"<td>"
            	+"<exts:textfield id='b' name='aa' value='#it.price' pageState='%{pageState}'  style='width:80px'></exts:textfield>元"
            	+"</td>"
            	+"<td>&nbsp;&nbsp;起订数</td>"							                	
            	+"<td>"
            	+"<exts:textfield id='a' name='bb' value='#it.minBookNum' pageState='%{pageState}'  style='width:80px'></exts:textfield>"
            	+"</td>"
            	+"<td><a href='javascript:doDelete('')'><img src='${ctx}/core/images/del.gif' name='icon_074' width='16' height='16' border='0' style='CURSOR: hand' title='删除'/></a></td>"
            	+"</tr>"; --%>
	<body>
		<form id="form0" action="${ctx}/platformManage/informationManage.action" method="post" name="mainform">
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" valign="top">
				<%@include file="/WEB-INF/core/common/message.jsp"%>
				<tr width="100%">
					<td>
						<table border="0" align="center" cellpadding="0" cellspacing="0">
							<tr width="100%">
								<td width="8" height="27" align="left"><img src="${ctx}/core/images/button_05.gif" width="8" height="27" /></td> 
		    					<td width="99%"  align="left" background="${ctx}/core/images/button_06.gif" class="bluecu">&nbsp;<img src="${ctx}/core/images/icon_04.gif" />&nbsp;合作商属性</td>
		    					<td width="8" align="right"><img src="${ctx}/core/images/button_07.gif" width="8" height="27" /></td>
		    				</tr>
		    			</table>
		    		</td>
		  		</tr>
				<tr>
					<td colspan="3" class="biaoge"  valign="top">
						<table width="100%" border="0" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF">
							<tr align="left">
								
        						<td width="10%" nowrap="nowrap" bgcolor="#DDE4EA" align="left">&nbsp;名称&nbsp;<font color="red">*</font></td>
        						<td width="40%" bgcolor="#DDE4EA" align="left">
        							<exts:textfield id="name" name="detailInfo.name" value="%{detailInfo.name}"  class="textbox_css" style="width:150px"/>
							    	      							
								</td>
								
								<td width="10%" height="20" bgcolor="#DDE4EA" nowrap align="left">&nbsp;类型&nbsp;<font color="red">*</font></td>
		        				<td nowrap width="40%" bgcolor="#DDE4EA" align="left">
		        					<s:if test="pageState=='add'">
							        	<exts:select id="type" name="detailInfo.type" value="%{detailInfo.type}" pageState="%{pageState}" exclude="0" code="ROOM_TYPE" ></exts:select>
							    	</s:if>
							     	<s:else>
							        	<exts:select id="type" name="detailInfo.type" value="%{detailInfo.type}" pageState="view" exclude="0" code="ROOM_TYPE" ></exts:select>
							      	</s:else>		        					
								</td>
      						</tr>						

						
					        <tr align="left">    							
						        <td height="20" bgcolor="#DDE4EA" nowrap align="left">&nbsp;数量(间)&nbsp;<font color="red"></font></td>
						        <td bgcolor="#DDE4EA" nowrap align="left">
						        	<exts:textfield id="number" name="detailInfo.number" value="%{detailInfo.number}" pageState="%{pageState}"  class="textbox_css" style="width:150px"/>
								</td>
								
						        <td bgcolor="#DDE4EA" nowrap align="left">&nbsp;预定次数&nbsp;</td>
						        <td bgcolor="#DDE4EA" nowrap align="left">
								</td>
							</tr>
							
							<tr align="left">
      							
						        <td height="20" bgcolor="#DDE4EA" nowrap align="left">&nbsp;参考价格(元/小时)&nbsp;<font color="red">*</font></td>
						        <td bgcolor="#DDE4EA" nowrap align="left">
						        	<exts:textfield id="price" name="detailInfo.price" value="%{detailInfo.price}" pageState="%{pageState}"  class="textbox_css" style="width:150px"/>
								</td>
								
						        <td bgcolor="#DDE4EA" nowrap align="left">&nbsp;状态&nbsp;</td>
						        <td bgcolor="#DDE4EA" nowrap align="left">
						        	<exts:select id="status" name="detailInfo.status" value="%{detailInfo.status}" pageState="view" exclude="0" code="ROOM_STATUS" ></exts:select>
						        </td>
							</tr>
							
							
							<tr align="left">
      							
						        <td height="20" bgcolor="#DDE4EA" nowrap align="left">&nbsp;开售时间&nbsp;<font color="red">*</font></td>
						        <td bgcolor="#DDE4EA" nowrap align="left">
						        	<s:if test="pageState=='view'">
						        		<s:date name='detailInfo.startTime'  format='yyyy-MM-dd HH:mm:ss'/>
						        	</s:if>
						        	<s:else>		        	
						        		<input id="startTime" name="q_startDate" value="<s:date name='detailInfo.startTime'  format='yyyy-MM-dd HH:mm:ss'/>"  class="textbox_css" style="width:150px" onClick="setAppDayHM(this);"/>
						        	</s:else>
						        </td>
								
						        <td bgcolor="#DDE4EA" nowrap align="left">&nbsp;结束时间&nbsp;<font color="red">*</font></td>
						        <td bgcolor="#DDE4EA" nowrap align="left">
						        	<s:if test="pageState=='view'">
						        		<s:date name='detailInfo.endTime'  format='yyyy-MM-dd HH:mm:ss'/>
						        	</s:if>
						        	<s:else>
						        		<input id="endTime" name="q_endDate" value="<s:date name='detailInfo.endTime'  format='yyyy-MM-dd HH:mm:ss'/>"  class="textbox_css" style="width:150px" onClick="setAppDayHM(this);"/>
						        	</s:else>
						        </td>
							</tr>
							
							
							
							<tr align="left">
      							
						        <td height="20" bgcolor="#DDE4EA" nowrap align="left">&nbsp;描述&nbsp;<font color="red"></font></td>
						        <td bgcolor="#DDE4EA" nowrap align="left" colspan=3>
						        	<exts:textfield id="description" name="detailInfo.description" value="%{detailInfo.description}" pageState="%{pageState}"  class="textbox_css" style="width:80%"/>
								</td>
								
							</tr>
						
						
      					    <tr align="left">
      							
						        <td height="20" bgcolor="#DDE4EA" nowrap align="left">&nbsp;订价段落&nbsp;<font color="red">*</font>
						        <s:if test="pageState!='view'">
						        	&nbsp;&nbsp;<a href="javascript:doAddPrice();"><img src="${ctx}/core/images/open2.gif" name="icon_064" width="16" height="16" border="0" id="icon_064" style="CURSOR: hand" title="增加"/></a>
						        </s:if>
						        </td>
						        <td bgcolor="#DDE4EA" nowrap align="left" colspan=3>
						        
			        
						        	<div >
						        	</br>	
						        		<table id="pricePlanArea" height="16" width="90%"  border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
						        		<s:set name="priceNums" value="0"></s:set>
						        		
						        		
						        	<s:if test="pageState=='add'">
						        		<intput type="hidden" name="priceBean[0].ownerID" value="<s:text name='%{detailInfo.detailId}'/>"/>	
							                <tr onclick='lineclick(this);'>
							                	<td width="3%" align="center">1</td>
							               		<td width="8%">&nbsp;&nbsp;时段</td>
							                	<td width="15%">
							                	<exts:select id="" name="priceBean[0].timeSegment" value="#it.timeSegment" pageState="%{pageState}" code="TIME_SEGMENT" ></exts:select>
							                	</td>
							                	<td width="8%">&nbsp;&nbsp;订价类型</td>
							                	<td width="12%">
							                	<exts:select id="" name="priceBean[0].priceType" value="#it.priceType" pageState="%{pageState}"  code="PRICE_TYPE" ></exts:select>
							                	</td>
							                	<td width="8%">&nbsp;&nbsp;价格(元)</td>
							                	<td width="12%">
							                	<exts:textfield id="b" name="priceBean[0].price" value="%{#it.price}" pageState="%{pageState}"  style="width:80px"></exts:textfield>
							                	</td>
							                	<td width="8%">&nbsp;&nbsp;起订数(小时)</td>							                	
							                	<td width="12%">
							                	<exts:textfield id="a" name="priceBean[0].minNum" value="%{#it.minBookNum}" pageState="%{pageState}"  style="width:80px"></exts:textfield>
												</td>
												
												<td align="center" width="4%"><a href="javascript:doRemovePrice()"><img src="${ctx}/core/images/del.gif" name="icon_074" width="16" height="16" border="0" style="CURSOR: hand" title="<s:text name='button.delete' />"/></a></td>
							               		
							                </tr>	
						       		 </s:if>
						        		
						        		
						        		<s:iterator value="detailInfo.pricePlan" id="it">
						        		
						        			<intput type="hidden" name="priceBean[<s:property  value='#priceNums'/>].ownerID" value="<s:text name='%{detailInfo.detailId}'/>"/>	
							                <tr onclick='lineclick(this);'>
							                	<td width="3%" align="center"><s:property  value="#priceNums+1"/></td>
							               		<td width="8%">&nbsp;&nbsp;时段</td>
							                	<td width="15%">
							                	<exts:select id="" name="priceBean[%{priceNums}].timeSegment" value="#it.timeSegment" pageState="%{pageState}" code="TIME_SEGMENT" ></exts:select>
							                	</td>
							                	<td width="8%">&nbsp;&nbsp;订价类型</td>
							                	<td width="12%">
							                	<exts:select id="" name="priceBean[%{priceNums}].priceType" value="#it.priceType" pageState="%{pageState}"  code="PRICE_TYPE" ></exts:select>
							                	</td>
							                	<td width="8%">&nbsp;&nbsp;价格(元)</td>
							                	<td width="12%">
							                	<exts:textfield id="b" name="priceBean[%{priceNums}].price" value="%{#it.price}" pageState="%{pageState}"  style="width:80px"></exts:textfield>
							                	</td>
							                	<td width="8%">&nbsp;&nbsp;起订数(小时)</td>							                	
							                	<td width="12%">
							                	<exts:textfield id="a" name="priceBean[%{priceNums}].minNum" value="%{#it.minBookNum}" pageState="%{pageState}"  style="width:80px"></exts:textfield>
												</td>
												<s:if test="pageState!='view'">
												<td align="center" width="4%"><a href="javascript:doRemovePrice()"><img src="${ctx}/core/images/del.gif" name="icon_074" width="16" height="16" border="0" style="CURSOR: hand" title="<s:text name='button.delete' />"/></a></td>
							               		</s:if>
							                </tr>
							             
							             <s:set name="priceNums" value="#priceNums+1"></s:set>
							             </s:iterator>   
							                
							          	</table>
							        </br>
						        	</div>
								</td>							

							</tr>

				
<%-- 							                <tr>
							               		<td align="left" width="8%" nowrap bgcolor="#DDE4EA">&nbsp;&nbsp;时段</td>
							                	<td align="left" width="15%" bgcolor="#DDE4EA" nowrap align="left" colspan=3>
							                	<exts:select id="" name="" value="#it.timeSegment" pageState="%{pageState}" code="TIME_SEGMENT" ></exts:select>
							                	</td>
							                	<td align="left"  width="10%" >&nbsp;&nbsp;订价类型</td>
							                	<td align="left" width="15%"  bgcolor="#DDE4EA" nowrap align="left" colspan=3>
							                	<exts:select id="" name="" value="#it.priceType" pageState="%{pageState}"  code="PRICE_TYPE" ></exts:select>
							                	</td>
							                	<td align="left"  width="8%" >&nbsp;&nbsp;价格</td>
							                	<td align="left" width="15%"  bgcolor="#DDE4EA" nowrap align="left" colspan=3>
							                	<exts:textfield id="b" name="aa" value="#it.price" pageState="%{pageState}"  style="width:80px"></exts:textfield>元
							                	</td>
							                	<td align="left" width="10%">&nbsp;&nbsp;起订数</td>							                	
							                	<td align="left" width="15%" bgcolor="#DDE4EA" nowrap align="left" colspan=3>
							                	<exts:textfield id="a" name="bb" value="#it.minBookNum" pageState="%{pageState}"  style="width:80px"></exts:textfield>
												</td>
												<td width="25" align="right" cellpadding="0" cellspacing="0"><a href="javascript:doDelete('')"><img src="${ctx}/core/images/del.gif" name="icon_074" width="16" height="16" border="0" style="CURSOR: hand" title="<s:text name='button.delete' />"/></a></td>
							                </tr> --%>


							<tr>
								<td height="10" colspan="4" background="../core/images/line5.gif">&nbsp;</td>
							</tr>
							<tr>
								<td height="25" colspan="4" align="center">
									<s:if test="pageState=='add'">
							        	<input name="act" type="hidden" value="addSubmit"/>
							        </s:if>
							        <s:elseif test="pageState=='edit'">
							        	<input name="act" type="hidden" value="editSubmit"/>						        	
							        	<input name="detailInfo.detailId" type="hidden" value="<s:text name='%{detailInfo.detailId}'/>"/>
							        </s:elseif>
							        <!--<input name="q_ownerID" type="hidden" value="<s:text name='%{q_ownerID}'/>"/>
						   
							        --><s:if test="pageState!='view'">
										<input id="saveButton" type="submit" class="btn" value="<s:text name='button.save'/>"/>
									</s:if>  
							        <input id="returnButton" type="button" class="btn" value="<s:text name='button.return'/>" onclick="location='platformManage/informationManage.action?act=reQuery'"/>
								</td>
							</tr>
						</table>
    				</td>
				</tr>
			</table>
		</form>
	</body>
</html>